'\"macro stdmacro
.\"
.\" Copyright (c) 2008 Aconex.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMLOGLABEL 1 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmloglabel\f1 \- check and repair a performance metrics archive label
.SH SYNOPSIS
\f3pmloglabel\f1
[\f3\-lLsv?\f1]
[\f3\-D\f1 \f2debug\f1]
[\f3\-h\f1 \f2hostname\f1]
[\f3\-p\f1 \f2pid\f1]
[\f3\-V\f1 \f2version\f1]
[\f3\-Z\f1 \f2timezone\f1]
\f2archive\f1
.SH DESCRIPTION
.B pmloglabel
verifies, reports on, and can modify all details of the labels in
each of the files of a Performance Co-Pilot (PCP) archive.
The archive has the base name
.I archive
and must have been previously created using
.BR pmlogger (1).
.PP
Each of the files in a PCP archive (metadata, temporal index, and one
or more data volumes) must contain a valid label at the start, else
the PCP tools will refuse to open the archive at all.
.PP
Thus, the primary function of
.B pmloglabel
is to be able to repair any inconsistent or corrupt label fields, such
that the entire archive is not lost.
It will not check the remainder of the archive, but it will give you a
fighting chance to recover otherwise lost data.
Together,
.B pmloglabel
and
.B pmlogextract
are able to produce a valid PCP archive from many forms of corruption.
.PP
Note that if the temporal index is found to be corrupt, the "*.index" file
can be safely moved aside and the archive will still be accessible, however
retrievals may take longer without the index.
.SH OPTIONS
The available command line options are:
.TP 5
\fB\-h\fR \fIhostname\fR, \fB\-\-host\fR=\fIhostname\fR
Modify the logged
.I hostname
in the archive label, for all files in the archive.
.TP
\fB\-l\fR, \fB\-\-label\fR
Dump out the archive label, showing the archive format version,
the time and date for the start and (current) end of the archive, and
the host from which the performance metrics values were collected.
.TP
\fB\-L\fR
Like
.BR \-l ,
just a little more verbose, showing also the timezone and creator
process identifier from the archive label.
.TP
\fB\-p\fR \fIpid\fR, \fB\-\-pid\fR=\fIpid\fR
Set the process identifier stored in the archive label to
.IR pid ,
for all files in the archive.
.TP
\fB\-s\fR
Rewrite the sentinel values which precede and follow the archive label,
for all files in the archive.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode.
Additional progress information is produced at each step.
.TP
\fB\-V\fR \fIversion\fR, \fB\-\-version\fR=\fIversion\fR
Stamp the
.I version
number into the magic number field at the start of the archive label,
for all files in the archive.
.TP
\fB\-Z\fR \fItimezone\fR, \fB\-\-timezone\fR=\fItimezone\fR
Changes the timezone in the archive labels to
.I timezone
in the format of the environment variable
.B TZ
as described in
.BR environ (7).
.TP
\fB\-?\fR, \fB\-\-help\fR
Display usage message and exit.
.SH EXAMPLES
The following demonstrates the use of
.B pmloglabel
in finding and then correcting a corrupt field (PID) in the label of the temporal index of
an archive named "20080125".
.sp 0.5v
.P
.in +1i
.ft CR
.nf
$ pmlogdump \-l 20080125
pmlogdump: Cannot open archive "20080125": Illegal label record at start of a PCP archive file
$ pmloglabel 20080125
Mismatched PID (5264/5011) between temporal index and data volume 0
$ pmloglabel \-p 5264 20080125
$ pmlogdump \-l 20080125
Log Label (Log Format Version 2)
Performance metrics from host fw1
  commencing Fri Jan 25 00:10:09.341 2008
  ending     Sat Jan 26 00:09:54.344 2008
.fi
.SH EXIT STATUS
.B pmloglabel
exits with status 0 if the archive labels are clean.
If invoked incorrectly, the exit status will be 1.
If corruption is detected and still exists at the end,
the exit status will be 2.
If requested to write out the archive labels, and some aspect of that
write out fails, then the exit status will be 3.
.SH FILES
.TP 5
.I $PCP_LOG_DIR/pmlogger/<hostname>
Default directory for PCP archives containing performance
metric values collected from the host
.IR <hostname> .
.SH PCP ENVIRONMENT
Environment variables with the prefix \fBPCP_\fP are used to parameterize
the file and directory names used by PCP.
On each installation, the
file \fI/etc/pcp.conf\fP contains the local values for these variables.
The \fB$PCP_CONF\fP variable may be used to specify an alternative
configuration file, as described in \fBpcp.conf\fP(5).
.SH DEBUGGING OPTIONS
The
.B \-D
or
.B \-\-debug
option enables the output of additional diagnostics on
.I stderr
to help triage problems, although the information is sometimes cryptic and
primarily intended to provide guidance for developers rather end-users.
.I debug
is a comma separated list of debugging options; use
.BR pmdbg (1)
with the
.B \-l
option to obtain
a list of the available debugging options and their meaning.
.SH SEE ALSO
.BR PCPIntro (1),
.BR pmlogcheck (1),
.BR pmlogdump (1),
.BR pmlogextract (1),
.BR pmlogger (1),
.BR pmlogger_check (1),
.BR pmlogger_daily (1),
.BR pmlogrewrite (1),
.BR pcp.conf (5)
and
.BR pcp.env (5).

.\" control lines for scripts/man-spell
.\" +ok+ fw {from hostname fw1}
